package com.gpframework.module.wages.domain.req;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.utils.StringUtils;
import com.gpframework.module.base.domain.req.BaseReq;
import com.gpframework.module.wages.domain.GzMonthlySalaryDetails;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.math.BigDecimal;

import java.util.Date;

/**
 * @ClassName GzMonthlySalaryDetailsReq
 * @Author gpframework
 * @Date 2024-04-09
 * @Version 1.0.0
 * @Description 列表查询信息体
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class GzMonthlySalaryDetailsReq extends BaseReq {
    private static final long serialVersionUID = 1L;

         @ApiModelProperty("月份")
     private Date month;
     @ApiModelProperty("部门")
     private String departmentName;
     @ApiModelProperty("月度工资总表id")
     private Long monthlySalaryId;
     @ApiModelProperty("月度工资类别（0拿货 1收货 2车队）")
     private String monthlySalaryType;
     @ApiModelProperty("名字")
     private String name;
     @ApiModelProperty("扣减餐费")
     private BigDecimal mealBuckle;
     @ApiModelProperty("实发工资")
     private BigDecimal netSalary;
     @ApiModelProperty("排序")
     private Long sort;
     @ApiModelProperty("备注")
     private String remarks;

    /**
    * @Description 生成查询wrapper
    * @Author greatplan@qq.com
    * @Date 2020-11-04 16:04
    * @Param [lqw]
    * @Param [isVO] 是否vo查询体，true的话走的是mapper.xml里面的查询语句，不过查询语法还是mybatis-plus，主要用于某些关联查询出一些非数据表字段
    * @Return void
    */
    public void generatorQuery(QueryWrapper<GzMonthlySalaryDetails> lqw,boolean isVo) {
        String alias = "";
        if (isVo) {
            alias = "gp.";
            lqw.eq(alias+"del_status",0);
        }
        if (this.getMonth() != null){
        lqw.eq(alias+"month" ,this.getMonth());
        }
        if (StringUtils.isNotBlank(this.getDepartmentName())){
            lqw.like(alias+"department_name",this.getDepartmentName());
        }
        if (this.getMonthlySalaryId() != null){
        lqw.eq(alias+"monthly_salary_id" ,this.getMonthlySalaryId());
        }
        if (StringUtils.isNotBlank(this.getMonthlySalaryType())){
        lqw.eq(alias+"monthly_salary_type" ,this.getMonthlySalaryType());
        }
        if (StringUtils.isNotBlank(this.getName())){
            lqw.like(alias+"name",this.getName());
        }
        if (this.getMealBuckle() != null){
        lqw.eq(alias+"meal_buckle" ,this.getMealBuckle());
        }
        if (this.getNetSalary() != null){
        lqw.eq(alias+"net_salary" ,this.getNetSalary());
        }
        if (this.getSort() != null){
        lqw.eq(alias+"sort" ,this.getSort());
        }
        if (StringUtils.isNotBlank(this.getRemarks())){
        lqw.eq(alias+"remarks" ,this.getRemarks());
        }
    }
}
